var TextBuilder = function(){
	var self = this;
	self.text = "";
	self.build = function(args){
		var t = arguments[0] + "";		
		var count = arguments.length;
		for(var i = 1; i < count; i+=1){
			var pattern = "\\{" + (i-1) + "\\}";
			t = t.replace(new RegExp(pattern, "g"), arguments[i]);
		}
		
		self.text += t;
	};
	
	self.buildLine = function(args){
		self.build.apply(this, arguments);
		self.build("\n");
	};
	
	self.toString = function(){
		return self.text;
	};
	
	self.clear = function(){
		self.text = "";
	};
}

var builder = new TextBuilder();